/**
 * @class   wosh::interfaces::services::SessionServer
 * @brief   Standard interface of Session Server (service).
 *
 * @ingroup Interfaces
 ****************************************************************************
 * @version 0.00 $Id: SessionServer.h 2074 2010-03-10 02:38:16Z alex $
 * @author  Alessandro Polo
 ****************************************************************************/
/* Copyright (c) 2007-2010, WOSH - Wide Open Smart Home 
 * by Alessandro Polo - OpenSmartHome.com
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *     * Redistributions of source code must retain the above copyright
 *       notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above copyright
 *       notice, this list of conditions and the following disclaimer in the
 *       documentation and/or other materials provided with the distribution.
 *     * Neither the name of the OpenSmartHome.com WOSH nor the
 *       names of its contributors may be used to endorse or promote products
 *       derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY Alessandro Polo ''AS IS'' AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL Alessandro Polo BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 ****************************************************************************/

#ifndef __WOSH_Interfaces_Services_SessionServer_H__
 #define __WOSH_Interfaces_Services_SessionServer_H__

 #include <interfaces/Service.h>


namespace wosh {
 class Message;
 namespace communication {
  class Session;
 };

 namespace interfaces {
  namespace services {

 #define _SessionServer_NAME				"SessionServer"
 #define _SessionServer_TYPE				"wosh::services::SessionServer"

 #define _SessionServer_KEY_WelcomeString	"WelcomeString"


class SessionServer : public virtual Service
 {
	WOSH_BUNDLE_INTERFACE("wosh::interfaces::services::SessionServer")


	public:
		static const int AllowedOnSameKernel = 1;	///< Only one instance is allowed on same kernel
		static const int AllowedOnSameNetwork = -1;	///< There can be multiple (any) instances on the network


/** @name SessionServer Interface
 * @{
 ******************************************************************************/
	public:


		virtual bool isUserLogged( const std::string& username ) const = 0;

		virtual long getSessionIDByUser( const std::string& username ) const = 0;

//@}
/** @name SessionServer Interface for Session callbacks
 * @{
 ******************************************************************************/
	public:

		virtual bool session_is_auth( wosh::communication::Session* session, const std::string& user, const std::string& pwd ) = 0;

		virtual bool session_post_message( wosh::communication::Session* session, wosh::Message* message ) = 0;

		virtual WRESULT changeSessionProtocol( wosh::communication::Session* session, const std::string& protocol_name ) = 0;


//@}

	public:
		SessionServer() { }

		virtual ~SessionServer() { }

}; // class def

  }; // namespace services
 }; // namespace interfaces
}; // namespace wosh

#endif //__WOSH_Interfaces_Services_SessionServer_H__
